package java_class_work.week08.demo4;

import java_class_work.week08.demo4.Ticket;

/**
 * @Author Tiam
 * @Date 2022/10/31 10:35
 * @Description:
 */
public class TicketDemo {
    public static void main(String[] args) {
        Ticket ticket = new Ticket();
        new Thread(ticket,"小李").start();
        new Thread(ticket,"小张").start();
        new Thread(ticket,"小王").start();
        /* output: 共享数据不安全, 同一张票同时被卖了三次
        小李 卖出了20号票,剩余19
        小王 卖出了20号票,剩余18
        小张 卖出了20号票,剩余17
         */
    }
}
